package com.spring.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class JMonitorMethodInterceptor implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        long startNano = System.nanoTime();

        System.out.println("====================start=============");

        try {
            return invocation.proceed();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            throw e;
        } finally {
            System.out.println("====================end=============spend:" + (System.nanoTime() - startNano));
        }

    }

}
